<!DOCTYPE html>
<html>
<head>
  <title>justice</title>
  <meta charset='utf-8'>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <script src="http://localhost:35729/livereload.js"></script>
</head>
<body>

  <style type="text/css">
    body {
      background-color: white;
      font-family: monospace;
      padding-bottom: 80px;
    }
    .main {
      max-width: 600px;
      margin: 0 auto;
    }
    h1 {
      font-weight: 900;
      font-size: 60px;
      margin: 40px auto;
      text-align: center;
      display: block;
      padding: 10px;
      font-family: monospace;
    }

    pre {
      background-color: black;
      padding: 10px;
      border-radius: 5px;
      color: white;
      line-height: 1.4em;
    }
    p {
      font-weight: bold;
      margin-top: 4em;
    }
    span {
      text-align: center;
      display: block;
    }
  </style>



  <div class="main">
    <h1>justice.js</h1>

    <span>
      <a href="https://github.com/okor/justice">github.com/okor/justice</a>
      | <a href="https://twitter.com/okor">@okor</a>
    </span>

<p>How to use</p>
<pre>
  &lt;script type=&quot;text/javascript&quot; src=&quot;justice.min.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
    Justice.init();
  &lt;/script&gt;
</pre>

<p>With options</p>
<pre>
  &lt;script type=&quot;text/javascript&quot; src=&quot;justice.min.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
    Justice.init({
      metrics: {
        TTFB:             { budget: 200   },
        domInteractive:   { budget: 250   },
        domComplete:      { budget: 800   },
        firstPaint:       { budget: 1000  },
        pageLoad:         { budget: 2000  },
        requests:         { budget: 6     },
      },
      warnThreshold: 0.08,
      showFPS: true,
      chartType: 'spline'
    });
  &lt;/script&gt;
</pre>
  </div>

  <script type="text/javascript" src="../build/justice.mapped.min.js"></script>

  <!-- loading jquery to simulate real world, post load, ajax requests -->
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  <script type="text/javascript">
    Justice.init({
      metrics: {
        TTFB:             { budget: 200   },
        domInteractive:   { budget: 250   },
        domComplete:      { budget: 800   },
        firstPaint:       { budget: 1000  },
        pageLoad:         { budget: 2000  },
        requests:         { budget: 6     },
      },
      warnThreshold: 0.08,
      showFPS: true,
      chartType: 'spline'
    });
  </script>


  <script type="text/javascript">
    // simulating some ajax requests that might occur on a real site
    $(function() {

      function someAJAX() {
        $.ajax({
          url: 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.1/Chart.js',
          dataType: "script"
        });
      }

      someAJAX();
      setTimeout(someAJAX, 2000);
      setTimeout(someAJAX, 4000)
    })
  </script>

</body>
</html>